<template>
    <div class="address-book-box">
        <el-tabs v-model="addressBookTabs">
            <el-tab-pane label="通讯录" name="addresBook">
                <div class="user-list">
                    <div class="user-item" @click="props.openChat">
                        <div class="user-picture">
                            <!-- <div class="pic">
                            <img src="" alt="">
                        </div> -->
                            <el-icon size="26" color="#fff"><UserFilled /></el-icon>
                        </div>
                        <div class="user-msg">
                            <span class="user-name">Chan Tai Man 陳大文</span>
                        </div>
                    </div>
                </div>
            </el-tab-pane>
            <el-tab-pane label="请求" name="request">
                <el-empty description="沒有通訊聯絡的請求" image=" " />
            </el-tab-pane>
        </el-tabs>
    </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'

const props = defineProps<{
    openChat?: (e: MouseEvent) => void
}>()

const addressBookTabs = ref('addresBook')
</script>

<style lang="less" scoped>
.address-book-box {
    height: 100%;

    :deep(.el-tabs) {
        height: 100%;

        .el-tabs__header {
            margin-bottom: 0;
            background-color: #eff1f3;

            .el-tabs__nav-wrap {
                &::after {
                    content: none;
                }

                .el-tabs__nav-scroll {
                    .el-tabs__nav {
                        padding: 15px;
                        width: 100%;

                        .el-tabs__active-bar {
                            display: none;
                        }

                        .el-tabs__item {
                            border-radius: 4px;
                            padding: 0;
                            width: 50%;
                            color: #242424;
                            font-size: 15px;

                            &:hover {
                                color: #000;
                            }

                            &.is-active {
                                background-color: #f06423;
                                color: #fff;
                            }
                        }
                    }
                }
            }
        }

        .el-tabs__content {
            background-color: #eff1f3;
            overflow-y: auto;
        }
    }

    .user-list {
        .user-item {
            border-bottom: 1px solid rgba(0, 0, 0, 0.085);
            padding: 8px;
            cursor: pointer;
            background-color: #fff;

            display: flex;
            align-items: center;

            &:hover {
                background-color: #f8f9fa;
            }

            &:last-child {
                border: none;
            }

            .user-picture {
                border-radius: 50%;
                background-color: #e5e5e5;
                width: 38px;
                height: 38px;

                display: flex;
                align-items: center;
                justify-content: center;
            }

            .user-msg {
                padding-left: 8px;
                flex-grow: 1;
                color: #4c4c4c;
                font-size: 15px;
                line-height: 1.666;

                .user-name {
                    font-weight: bold;
                    display: block;
                }

                .msg {
                    display: block;
                }
            }

            .time {
                font-size: 12px;
                color: #4c4c4c;
            }
        }
    }

    .el-empty {
        --el-empty-padding: 10px 0;
        --el-empty-description-margin-top: 0;

        .el-empty__image {
            display: none;
        }
    }
}
</style>
